package com.ikproducts.manualian.server;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;


@SuppressWarnings("serial")
public class GoogleLoginServlet extends HttpServlet {
	
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		 UserService service = UserServiceFactory.getUserService();
		 
		 if(req.getUserPrincipal() != null){
			 resp.sendRedirect("");
		 }
		 else{
			 resp.sendRedirect(service.createLoginURL(req.getRequestURI())); 
		 }
	}
}
